package com.kang.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.kang.dao.AuditItemMapper;
import com.kang.dao.IntemInformationMapper;
import com.kang.dao.ItemDetailMapper;
import com.kang.pojo.IntemInformation;
import com.kang.pojo.ItemDetail;
import com.kang.service.InventoryService;
import com.vonechina.entity.page.InventoryQueryPage;
import com.vonechina.entity.page.InventoryWarningPage;
import com.vonechina.entity.page.ItemBatchPage;
import com.vonechina.entity.page.ValidityWarningPage;

/**
 * 库存管理服务接口实现类
 * @author wd
 *
 */
@Service
public class InventoryServiceImpl implements InventoryService {
	/**
	 * 物品DAO层
	 */
	@Resource
	private IntemInformationMapper iif;
	/**
	 * 物品批次DAO层
	 */
	@Resource
	private ItemDetailMapper idm;
	/**
	 * 工作流程-审批级别DAO层
	 */
	@Resource
	private AuditItemMapper audits;
	
	/**
	 * 库存预警--查询总条数
	 */
	@Override
	public int getInventoryWarningCount(InventoryWarningPage inventoryWarningPage) {
		return iif.getInventoryWarningCount(inventoryWarningPage);
	}

	/**
	 * 库存预警-查询数据集合
	 */
	@Override
	public List<IntemInformation> getInventoryWarningList(InventoryWarningPage inventoryWarningPage) {
		return iif.getInventoryWarningList(inventoryWarningPage);
	}

	/**
	 * 有效期预警--查询总条数
	 */
	@Override
	public int getValidityWarningCount(ValidityWarningPage validityWarningPage) {
		return iif.getValidityWarningCount(validityWarningPage);
	}

	/**
	 * 有效期预警--查询数据
	 */
	@Override
	public List<IntemInformation> getValidityWarningList(ValidityWarningPage validityWarningPage) {
		return iif.getValidityWarningList(validityWarningPage);
	}

	/**
	 * 库存管理--库存查询总条数
	 */
	@Override
	public int getInventoryQueryCount(InventoryQueryPage inventoryQueryPage) {
		return iif.getInventoryQueryCount(inventoryQueryPage);
	}

	/**
	 * 库存管理--库存查询
	 */
	@Override
	public List<IntemInformation>  getInventoryQueryList(InventoryQueryPage inventoryQueryPage) {
		return iif.getInventoryQueryList(inventoryQueryPage);
	}

	/**
	 * 根据物品id查询所有的批次信息
	 */
	@Override
	public List<ItemDetail> getAllBatchInfoById(ItemBatchPage itemBatchPage) {
		itemBatchPage.setRows(idm.getAllBatchInfoCountById(itemBatchPage));
		return idm.getAllBatchInfoById(itemBatchPage);
	}

	/**
	 * 桌面获取前4条库存预警
	 */
	@Override
	public List<IntemInformation> getDesktopInventoryWarningList() {
		return iif.getDesktopInventoryWarningList();
	}

	/**
	 * 桌面获取前4条有效期预警
	 */
	@Override
	public List<IntemInformation> getDesktopValidityWarningList() {
		return iif.getDesktopValidityWarningList();
	}
}
